home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 July
/
1984-07.d64
/
robot math_vic
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
102 lines
1 readp1$,p2,p3$,p4:goto62
2 pokeb,0:pokeb+1,0:pokeb+2,0:pokeb+4,0:return
3 pokeb+4,15:pokeb+1,180:form=1toc:next:goto2
4 f=int(rnd(1)*9):return
5 poked,3:poked+1,3:pokeb+4,15:forl=99to255:pokeb+2,l:pokeb,l:next:gosub2:goto92
6 pokeb+4,15:pokeb+2,160:form=1to400:next:goto2
7 printm$;" press rtn to change":return
8 printm$;" enter digit[146] ":return
9 iff>5thenl=126:iff>9thenl=108:m=1:iff>30thenl=90:m=0:iff>50thenl=108:m=1:iff>99thenf=0
10 pokee,l:pokee+1,l:poked+21,m:poked+24,m:goto36
11 print"":printtab(l);m$;o$;:gosub3:printn$:return
12 m$=" [206][163][163][205] [157][157][157][157][157][157] [205][218][218][206] [157][157][157][157][157][157] [187][204][186][172] [157][157][157][157][157][157] [169][171][179][223] [157][157][157][157][157][157] [207][208] [157][157][157][157][157][157] [169] [223][146] "
13 n$="[157][157][157][157][157][157] [215][215][215][215] ":o$="[157][157][157][157][157][157] [218][218][218][218] ":b=36874:readp1$,p2,p3$,p4:pokeb+5,30:poke649,1
14 print"[147] m=menu-----del=erase ":l8=48:poke143,peek(162):goto92
15 poke651,255:print"":r=38649:s=7929:y=p2:d=38446:e=7726:ifp1$="-"orp2=1orp2>3theny=2
16 fori=p2to1step-1:a(i)=0:s(i)=0:fork=1toy:gosub3:gosub4
17 a(i)=a(i)+f:s(i)=s(i)-f
18 m=(k*22)+i:poker+m,4:pokes+m,f+48:ifk=1thenl1=f
19 next:ifp1$="-"thengosub57:goto21
20 l=a(i):n=9:goto22
21 s(i)=s(i)+2*l1:l=s(i):n=0
22 gosub49:a(i)=l
23 nexti
24 fork=1toy:fori=1top2
25 m=k*22+i:ifpeek(s+m)>48then28
26 ifi=p2thenv=1
27 pokes+m,32:next
28 nextk:ifv=1thenv=0:goto15
29 a=0:u=-1:fori=p2to1step-1:u=u+1:ifp1$="-"thena=a+s(i)*10^u:goto31
30 a=a+a(i)*10^u
31 next
32 a=int(a):l2=0:ifa<0then15
33 print"":fori=2toy:printtab(7);p1$:next:poke160,0:poke161,0:poke162,0
34 print"[145][145][145][145]":fork=0top2:printtab(7+k);"[195][157] [145][145][145][145][145]":next
35 print"":u=len(str$(a))-2:i=0:l1=0:fork=p2top2-ustep-1
36 form=6to8:pokem+e+154,asc(mid$(ti$,m-2))+128:next:ifti$="000400"thengosub6:goto46
37 geta$:ifa$=""thenl=124:f=f+1:goto9
38 ifasc(a$)=20thenprinttab(7);" ";"[145][145][145][145][145]":goto35
39 ifa$="m"thenpokeb+5,27:goto62
40 ifa$<"0"ora$>"9"then37
41 l1=int(l1+val(a$)*10^i):i=i+1:printtab(7+k);a$:print"[145][145]":next
42 ifl1=athengosub5
43 ifl1<>athengosub6
44 l2=l2+1:ifl2>2then46
45 print"[145][145]":goto34
46 v=0:an$=str$(a):l=len(an$):ifl>p2+1thenv=1
47 ifl-1<p2thenv=l-1-p2
48 printtab(8-v);"";mid$(an$,2,8):fork=1to3500:next:goto15
49 ifp3$="n"andp1$="+"then52
50 gosub4:x=1:ifl<n+fthen54
51 return
52 ifl>nthenx=-1:goto54
53 return
54 l=0:fork=1toy:m=(k*22)+i:f=peek(s+m)+x:iff<48thenf=48
55 iff>57thenf=57
56 pokes+m,f:l=l+(f-48):next:goto49
57 ifp3$="n"then60
58 ifi=1orf>=l1thenreturn
59 goto61
60 iff<l1thenreturn
61 pokes+m,l1+48:pokes+m-22,f+48:s(i)=(-f)-l1:l1=f:return
62 m$="":print"[147]operation (+/-).... ";p1$
63 print"# digits (max=6)...";p2:print"carry/borrow....... ";p3$
64 print"# problems (max=9).";p4:print" [197][197][197][197][197][197][197][197][197][197][197][197][197][197]
65 [141]7:[153]" open(b to begin)";"select:use crsr(up/dn)stop
66 m=7746
67 ifm1=7878thenm=7746
68 fori=mtom+20:pokei,peek(i)+128:next
69 geta$:ifa$=""then69:a=a+128:pokei,a:next
70 ifval(a$)<10andval(a$)>0then82
71 ifa$="+"ora$="-"ora$="y"ora$="n"orpeek(197)=15thena$="1":goto82
72 ifa$=""then77
73 ifa$="[145]"then81
74 ifa$<>"b"then69
75 print"[147]91 data";p1$;",";p2;",";p3$;",";p4:print"run12";"
76 :[151]198,3:[151]631,13:[151]632,13:[151]633,13:[128]
77 m2[178]m2[171]1:k[178]44
78 m[178]m[170]k:[129]i[178]m[171]k[164]m[171]k[170]20:[151]i,[194](i)[171]128:[130]:[139]m[177]7878[167]m[178]7746
79 [139]m[179]7746[167]m[178]7878
80 [145](m[171]7702)[173]44[141]7,8,7,8:[137]67
81 m2[178]m2[171]1:k[178][171]44:[137]78
82 [145](m[171]7746)[173]44[137]85,87,90:[139]p1$[178]"+"[167]p1$[178]"-":[137]84
83 p1$[178]"+"
84 [151]m[170]20,[198](p1$)[170]128:[137]69
85 [139][197](a$)[177]6[167]a$[178]"6"
86 p2[178][197](a$):[151]m[170]20,p2[170]176:[137]69
87 [139]p3$[178]"n"[167]p3$[178]"y":[137]89
88 p3$[178]"n"
89 [151]m[170]20,64[170][198](p3$):[137]69
90 p4[178][197](a$):[151]m[170]20,p4[170]176:[137]69
91 [131]+, 1 ,y, 2
92 c[178]0:[153]"stop":[129]l[178]0[164]15:[141]11:[130]
93 [129]l[178]14[164]0[169][171]1:[141]11:[130]:[153]"stop":c[178]40
94 l8[178]l8[170]1:m[178]34816[170]8[172]l8:[153]"":[139]l8[171]48[177]p4[167]98
95 [129]m1[178]m[164]m[170]6:x[178][194](m1):[129]l[178]1[164]7:c[178]32:x[178]x[172]2:[139]x[177]255[167]x[178]x[171]256:c[178]l8
96 [153][163]13)"open";[199](c);:[130]:[153]"stop":[130]:[139]l8[171]48[177]p4[167]98
97 [137]15
98 [151]b[170]5,27:[153]"load";[166]176);"play another game(y/n)wait"
99 [161]z$:[139]z$[178]""[176](z$[179][177]"y"[175]z$[179][177]"n")[167]99
100 [139]z$[178]"n"[167][128]
101 [138]1